package com.gitee.fanx.retty.spring.controller;

import org.springframework.web.bind.annotation.*;

import com.gitee.fanx.retty.spring.User;

//@RestController
//@RequestMapping("/users")
public class UserController {

	@GetMapping("")
	public User listUser(@RequestParam String a) {
		// 查询用户
		User user = new User();
		user.setId(1);
		user.setName("Leo");
		user.setAge((short) 18);
		return user;
	}

	@PutMapping("")
	public User postMethod(@RequestBody User body) {
		// 添加用户
		User user = new User();
		user.setId(body.getId());
		user.setName(body.getName() + "-update");
		user.setAge(body.getAge());
		return user;
	}

}
